
    <link rel="stylesheet" href="css/template.css" type="text/css" />
    <link rel="stylesheet" href="css/validationEngine.jquery.css" type="text/css" />

        <script type="text/javascript" src="js/jquery.validationEngine.js"></script>
        <script type="text/javascript" src="js/jquery.validationEngine-vi.js"></script>
         
        
<div id="gioithieu">
    	<div id="tieude_1">
    <p>THÔNG TIN LIÊN HỆ</p>
</div>
	
<script>
jQuery(document).ready(function($) {
jQuery("#dat_tour").validationEngine();
});
</script>

<div id="noidung_gt">
		<?php
			require"connect.php";

			$sql="select max( MA_YEU_CAU) from  qldl_yeu_cau_mo_tour"; 
			$result=mysql_query($sql); 
			$kq=mysql_fetch_array($result); 
			$ma=$kq[0]+1; 
				?>
          <form name="dat_tour" id="dat_tour" action="" method="post">
          <fieldset>
         	<table border="0" id="bang">
               
             
                  <tr>
                    <td><p>Họ tên</p></td>
                    <td>
                    <input type="text" name="ten" class="validate[required] text-input"  /></td>
                  </tr>
                    <tr>
                    <td ><p>CMND</p></td>
                    <td>
                    <input type="text" name="cmnd" class="validate[required,custom[cmnd]]" /></td>
                  </tr>
                  <tr>
                    <td ><p>Email</p></td>
                    <td>
                    <input type="text" name="mail" class="validate[required,custom[email]]"/></td>
                  </tr>
                  <tr>
                    <td ><p>Điạ chỉ</p></td>
                    <td>
                    <input type="text" name="dc" class="validate[required] text-input"/></td>
                  </tr>
                     <tr>
                    <td ><p>Số điện thoại</p></td>
                    <td>
                    <input type="text" name="dt"  class="validate[required,custom[phone]]"/></td>
                  </tr>
                      <tr>
                    <td><p>Tên tour</p></td>
                    <td>
                    <input type="text" name="tentour" class="validate[required] text-input"  /></td>
                  </tr>
                      <tr>
                    <td><p>Thời gian KH</p></td>
                    <td>
                    <input type="text" name="tg" class="validate[custom[date],future[NOW]]"  /></td>
                  </tr>
                      <tr>
                    <td><p>Số ngày</p></td>
                    <td>
                    <input type="text" name="sn" class="validate[required,custom[sn]]"/></td>
                  </tr>
                      <tr>
                    <td><p>Số chỗ</p></td>
                    <td>
                    <input type="text" name="sc" class="validate[required,custom[sc]]"  /></td>
                  </tr>
                    <tr>
                    <td ><p>Nội dung</p></td>
                    <td>
                    <textarea name="nd" cols="20" rows="50" class="validate[required] text-input"></textarea></td>
                  </tr>
                
                  <tr>
                    <td>&nbsp;</td>
                  </tr>
                  <tr>
                    <td>&nbsp;</td>
                    <td id="nut"><input type="submit" name="ok" value="Gửi yêu cầu" /></td>
                   
                  </tr>
                </table>
                </fieldset>
			</form>
             <?php
			
				
			if(isset($_POST["ok"]))
				{		
		
					$cmnd=$_POST["cmnd"];
					$ten = $_POST["ten"];
					$mail = $_POST["mail"];
					$dc = $_POST["dc"];
					$dt = $_POST["dt"];
						$sql="insert into qldl_khach_hang_dat_tour (EMAIL,TEN_KHACH_HANG,DIA_CHI,CMND,SO_DIEN_THOAI)
								values('$mail','$ten','$dc','$cmnd','$dt');--";
					$insert=mysql_query($sql);
			if(isset($_POST["ok"]))
				{		
					$nd=$_POST["nd"];
					$mail = $_POST["mail"];
					$sc=$_POST["sc"];
					$sn=$_POST["sn"];
					$tentour=$_POST["tentour"];
					$tg=$_POST["tg"];
					
					$sql1="insert into qldl_yeu_cau_mo_tour 	     							    (MA_YEU_CAU,EMAIL,TEN_TOUR,TG_BAT_DAU,SO_NGAY,SO_CHO,YEU_CAU) 
								values ('$ma','$mail','$tentour','$tg','$sn','$sc','$nd');--";
					$insert1=mysql_query($sql1);
						}
			
						if(mysql_affected_rows()== 0 || mysql_affected_rows()== -1 )
							{
								echo "<script> alert('Yêu cầu mở tour thất bại'); </script>";
			
								}
						else
							{
								echo "<script> alert('Cám ơn quý khách!'); </script>";
			  					echo "<meta http-equiv='refresh' content='0;url= index.php'>";
								}
		
	}
	

?> 
</div>
</div>

